#include<stdio.h>

int main(void) {
    int num, a, b, c, d;
    scanf("%d", &num); 
    a = num/ 1000;
    b = (num / 100) % 10;
    c = (num / 10) % 10;
    d = num % 10;
    printf("%d", a + b + c + d);
    return 0;
}